package de.mk.swing;

import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Properties;

import javax.swing.JFrame;

import de.mk.config.LoadProperties;
import de.mk.model.Board;
import de.mk.model.Picture;

public class MainFrame extends JFrame implements MouseListener {

//	private JFrame frame;
	private BoardPanel boardPanel = null;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MainFrame window = new MainFrame();
					window.setVisible(true);

				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 * 
	 * @throws Exception
	 */
	public MainFrame() throws Exception {
		super();
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 * 
	 * @throws Exception
	 */
	private void initialize() throws Exception {

		Properties props = LoadProperties.getProperties();

		int width = Integer.valueOf(props.getProperty("width"));
		int height = Integer.valueOf(props.getProperty("height"));

		this.addMouseListener(this);
		setBounds(100, 100, width, height);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		// init model
		Board board = new Board(props);
		
		//draw model
		boardPanel = new BoardPanel(board, props);
		boardPanel.setVisible(true);
	
		add(boardPanel);	
		

	}

	@Override
	public void mouseClicked(MouseEvent e) {
		repaint();	
		System.out.println("TEst");
	}

	@Override
	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mousePressed(MouseEvent e) {
		repaint();
		System.out.println("TEst");
		
	}

	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

}
